package com.cc.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author 晓东√
 * @since 2025-09-16 10:39
 */
@Getter
@Setter
@ToString
@TableName("book")
@Tag(name = "书籍类", description = "书籍类")
public class Book implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "id")
    private Integer id;

    @TableField("book_name")
    @Schema(description = "书名")
    private String bookName;

    @TableField("author")
    @Schema(description = "作者")
    private String author;

    @TableField("publication_date")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "出版日期")
    private Date publicationDate;

    @TableField("price")
    @Schema(description = "价格")
    private BigDecimal price;

    @TableField("cover_image_url")
    @Schema(description = "封面图片URL")
    private String coverImageUrl;

    @TableField("book_type_id")
    @Schema(description = "书籍类型ID")
    private Integer bookTypeId;
    // 创建时间
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private Date createdAt;
    // 更新时间
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间")
    private Date updatedAt;
    // 乐观锁
    @Version
    @TableField(value = "version", fill = FieldFill.INSERT)
    @Schema(description = "乐观锁")
    private Integer version;
}
